﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SD.DataAccess;
using System.Collections.ObjectModel;

namespace SD.Business
{
    public partial class DirectorateBUS
    {
        /// <summary>
        /// add new Directorate to database
        /// </summary>
        /// <param name="newDirectorate"> an instance of Directorate class </param>
        /// <returns> true or false </returns>

        public bool AddDirectorate(Directorate newDirectorate)
        {
            bool success = new Directorate().AddDirectorate(newDirectorate);
            return success;
        }

        /// <summary>
        /// edit new Directorate to database
        /// </summary>
        /// <param name="newDirectorate"> an instance of Directorate class </param>
        /// <returns> true or  false </returns>
        public bool AmendDirectorate(Directorate newDirectorate)
        {
            bool success = new Directorate().AmendDirectorate(newDirectorate);
            return success;
        }

        /// <summary>
        /// edit status Directorate to database
        /// </summary>
        /// <param name="DirectorateId"> DirectorateId want to edit status </param>
        /// <param name="status"> status Directorate want to change </param>
        /// <returns> true or false </returns>
        public bool ChangeDirectorateStatus(int DirectorateId, bool status)
        {
            bool success = new Directorate().ChangeDirectorateStatus(DirectorateId, status);
            return success;
        }

        /// <summary>
        /// get list Directorate 
        /// </summary>
        /// <param name="status"> status want to select </param>
        /// <param name="filter"> type of filter </param>
	    /// <param name="sortBy"> type of sort </param>
	    /// <param name="sortType"> sort a->z or z->a </param>	
        /// <returns> list Directorate </returns>
        public List<StoredDirectorateResult> ListDirectorate(bool status, string filter, string sortBy, int sortType)
        {
            List<StoredDirectorateResult> newDirectorate = new Directorate().ListDirectorate(status, filter, sortBy, sortType);
            return newDirectorate;
        }

        /// <summary>
        /// get list Directorate 
        /// </summary>
        /// <param name="status"> status want to select </param>
        /// <param name="filter"> type of filter </param>
        /// <param name="sortBy"> type of sort </param>
        /// <param name="sortType"> sort a->z or z->a </param>	
        /// <returns> list Directorate </returns>
        public List<StoredDirectorateOrganizationResult> ListDirectorateOrganization(int orgId, bool status, string filter, string sortBy, int sortType)
        {
            List<StoredDirectorateOrganizationResult> newDirectorate = new Directorate().ListDirectorateOfOrganization(orgId, status, filter, sortBy, sortType);
            return newDirectorate;
        }

        /// <summary>
        /// get Directorate selected
        /// </summary>
        /// <param name="DirectorateId"> DirectorateId selected </param>
        /// <returns> Directorate </returns>
        public DirectorateView GetDirectorate(int DirectorateId)
        {
            DirectorateView newDirectorate = new Directorate().GetDirectorate(DirectorateId);
            return newDirectorate;
        }

        /// <summary>
        /// check name has already existed ?
        /// </summary>
        /// <param name="name"> name want to check </param>
        /// <returns> true or false </returns>
        public bool CheckNameDirectorate(string name)
        {
            bool success = new Directorate().CheckNameDirectorate(name);
            return success;
        }
    }
}
